import { instance as request } from '../request'

/**
 * 创建收获
 * @param data
 * @returns
 */
export const createHarvestApi = (data: createHarvestItf): PromiseRes =>
  request.post('/harvest/create', data)

/**
 * 删除收获
 * @param id 收获id
 * @returns
 */
export const deleteHarvestApi = (id: string): PromiseRes =>
  request.delete(`/harvest/delete/${id}`)

/**
 * 更新收获描述
 * @param data
 * @returns
 */
export const updateHarvestApi = (data: updateHarvestItf): PromiseRes =>
  request.put('/harvest/update', data)

/**
 * 修改收获模块
 * @param data
 * @returns
 */
export const modifyHarvestModuleApi = (
  data: modifyHarvestModuleItf
): PromiseRes => request.put('/harvest/modifyModule', data)

/**
 * 分页查询项目收获
 * @param param 分页信息以及项目id
 * @returns
 */
export const getHarvestPageListApi = (
  params: getHarvestPageItf
): PromiseRes<getHarvestPageResultItf> =>
  request.get('/harvest/pageList', { params })

/**
 * 获取收获详情
 * @param params
 * @returns
 */
export const getHarvestDetailApi = (
  harvestId: string
): PromiseRes<getHarvestResultItf> =>
  request.get(`/harvest/detail/${harvestId}`)

/**
 * 获取收获的示例列表
 * @param harvestId 收获id
 * @returns
 */
export const getHarvestExamplesApi = (
  harvestId: string
): PromiseRes<getExampleResultItf[]> =>
  request.get(`/harvest/exampleList/${harvestId}`)
